//
//  ReceieveViewController.m
//  maocuhuiOASystem
//
//  Created by michael on 16/4/29.
//  Copyright © 2016年 czd. All rights reserved.
//

#import "ReceieveViewController.h"
#import "FSWaitReceiveController.h"
@interface ReceieveViewController ()
@property (nonatomic,strong)NSArray* array;

@end

@implementation ReceieveViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
      _array = [NSArray arrayWithObjects:@"待收文件",@"已收文件",@"已发文件",nil];
     self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
   UIBarButtonItem *barButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"返回" style:UIBarButtonItemStyleDone target:nil action:nil];
    self.navigationItem.backBarButtonItem = barButtonItem;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section

{
return 3;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
//       static NSString * cellIdentifier = @"cellIdentifier";
//            UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
//            if (cell == nil) {
//                cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
//            }
    UITableViewCell *cell = [[UITableViewCell alloc]init];
    UIImageView *image = [[UIImageView alloc]initWithFrame:CGRectMake(15, 15, 40, 40)];
    image.image = [UIImage imageNamed: _array[indexPath.row]];
[cell.contentView addSubview:image];
//    cell.imageView.image = [UIImage imageNamed: _array[indexPath.row]];
    UILabel *textLabel = [[UILabel alloc]init];

    cell.imageView.size = CGSizeMake(30 ,30);
    textLabel.frame = CGRectMake(image.right+10, 5, 100, 60);
    textLabel.text = _array[indexPath.row];
    [cell.contentView addSubview:textLabel];

  UILabel  *label= [[UILabel alloc]initWithFrame:CGRectMake(45, 10, 15, 15)];
    label.backgroundColor = [UIColor redColor];
    label.layer.cornerRadius = 7;
    label.layer.masksToBounds = YES;
    label.textAlignment = NSTextAlignmentCenter;
//    label.font = [UIFont boldSystemFontOfSize:2.0];
    label.textColor = [UIColor whiteColor];
    
UIFont *font = [UIFont boldSystemFontOfSize:(10)];
label.font = font;
    [cell.contentView addSubview:label];

    if (indexPath.row==0) {
        label.text = self.string;
        if ([self.string integerValue] !=0) {
            label.hidden = NO;
        }else{
         label.hidden = YES;
        }
    }else{
    label.hidden = YES;
    
    }

    
    
    
return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 70;
}

- (void )tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
 FSWaitReceiveController * dueInVC = (FSWaitReceiveController*)[self.storyboard instantiateViewControllerWithIdentifier:@"WaitReceive"];
   

if (indexPath.row==0) {
    dueInVC.vcType = WaitForSignType;
        [self.navigationController pushViewController:dueInVC animated:YES];
}
if(indexPath.row==1) {
    dueInVC.vcType = AlreadySignType;
        [self.navigationController pushViewController:dueInVC animated:YES];
}
if(indexPath.row==2) {
    dueInVC.vcType = SenderSinType;
        [self.navigationController pushViewController:dueInVC animated:YES];

}




}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
